<template>
<BasicDrawer
    v-bind="$attrs"
    @register="registerDrawer"
    :showFooter="false"
    :title="getTitle"
    :isDetail="false"
    :width="getIsMobile ? '95%':'80%'"
    @ok="handleSubmit"
  >
    <div class="desc-wrap">
      <div v-for="i in 10" :key="i">这是意见反馈{{ state.data }}资料Tab</div>
    </div>
  </BasicDrawer>
</template>
<script lang="ts" setup>
  import { reactive, computed, unref } from 'vue';
  import { BasicDrawer, useDrawerInner } from '@/components/Drawer';
  import { useAppInject } from '@/hooks/web/useAppInject';

  defineOptions({ name: 'DeptModal' });

  const { getIsMobile } = useAppInject();

  const emit = defineEmits(['success', 'register']);

  const state = reactive({
    data: {},
  });

  const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
    setDrawerProps({ confirmLoading: false });
    state.data = data;
  });

  const getTitle = computed(() => '查看意见反馈');

  async function handleSubmit() {
    try {

      setDrawerProps({ confirmLoading: true });

      closeDrawer();
      emit('success');
    } finally {
      setDrawerProps({ confirmLoading: false });
    }
  }
</script>

<style></style>
